import { createApp } from 'vue'
import App from './App.vue'
import { createRouter, createWebHistory } from 'vue-router';
import axios from 'axios';

import LoginPage from './components/Login.vue'
import AdminPage from './components/AdminPage.vue';  // 引入 AdminPage 组件
import TaskReview from './components/TaskReview.vue';
import Chat from './components/Chat.vue';
import HandlePage from './components/HandlePage.vue';
import DecisionPage from './components/DecisionPage.vue';
import AuditTask from '@/components/AuditTask.vue';
import ChatHistory from './components/ChatHistory.vue';


// 设置 axios 的默认基础 URL
axios.defaults.baseURL = 'http://10.33.102.23/api'; // 替换为实际的后端地址

const routes = [
    { path: '/', component: LoginPage, name: 'login' },
    { path: '/decision', component: DecisionPage },
    { path: '/adminpage', component: AdminPage, name: 'adminpage' },  // 配置管理员页面路由
    {
        path: '/task-review',
        name: 'task-review',
        component: TaskReview, // 跑腿任务审核页面路由
    },
    {
        path: '/chat',
        name: 'chat',
        component: Chat, // 聊天页面路由
    },
    {
        path: '/handle-page',
        name: 'handle-page',
        component: HandlePage, // 处理页面路由
    },
    {
        path: '/audit-task',
        component: AuditTask
    },
    {
        path: '/chat-history',
        name: 'chat-history',
        component: ChatHistory, // 聊天记录页面路由
    },

]

const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;

createApp(App)
    .use(router)  // 确保你将路由器应用到应用实例中
    .mount('#app');

